<html>
<head><meta charset="utf-8"><title>mental model · t-lang/pub-macro-rules · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/index.html">t-lang/pub-macro-rules</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/topic/mental.20model.html">mental model</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227748164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276890-t-lang/pub-macro-rules/topic/mental%20model/near/227748164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/topic/mental.20model.html#227748164">(Feb 25 2021 at 10:44)</a>:</h4>
<p>I was thinking about why I somewhat prefer the story of "pub makes macros work like normal items" to "an attribute makes them behave the old way"</p>



<a name="227748185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276890-t-lang/pub-macro-rules/topic/mental%20model/near/227748185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/topic/mental.20model.html#227748185">(Feb 25 2021 at 10:44)</a>:</h4>
<p>I don't know what is really easier for users</p>



<a name="227748262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276890-t-lang/pub-macro-rules/topic/mental%20model/near/227748262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/topic/mental.20model.html#227748262">(Feb 25 2021 at 10:45)</a>:</h4>
<p>maybe it'd be nice to review how we would teach etc</p>



<a name="227748312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276890-t-lang/pub-macro-rules/topic/mental%20model/near/227748312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/topic/mental.20model.html#227748312">(Feb 25 2021 at 10:46)</a>:</h4>
<p>I guess that "adding pub" feels like improving the existing story -- it's "just" a better version of macro-use and macro-export</p>



<a name="227748366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276890-t-lang/pub-macro-rules/topic/mental%20model/near/227748366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/topic/mental.20model.html#227748366">(Feb 25 2021 at 10:46)</a>:</h4>
<p>but macros are still fundamentally different and weird</p>



<a name="227748411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276890-t-lang/pub-macro-rules/topic/mental%20model/near/227748411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/topic/mental.20model.html#227748411">(Feb 25 2021 at 10:46)</a>:</h4>
<p>versus a case of "they're almost normal, but you can make them weird to cover some corner cases that are difficult to manage otherwise"</p>



<a name="227758151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276890-t-lang/pub-macro-rules/topic/mental%20model/near/227758151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/276890-t-lang/pub-macro-rules/topic/mental.20model.html#227758151">(Feb 25 2021 at 12:23)</a>:</h4>
<p>I think this depends on how much of current patterns can be expressed in the path based system. If the answer is only 0.0001% of current use cases cannot be expressed in a path based world, then it seems fine to have this "escape hatch", but if the figure is way higher (and I suspect it is), then having an escape hatch that almost anyone who makes a non-trvial macro needs to use, is very unfortunate.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>